#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "MSTK.h"


#ifdef __cplusplus
extern "C" {
#endif

  /* This function send mesh to processor rank in communicator comm


     must call PMESH_BuildPType() and PMESH_AddGhost() first
          
  */
int MESH_SendMesh(Mesh_ptr mesh, int rank, MPI_Comm comm) {
  int nf, nr;
  /* basic mesh information */
  printf("in MESH_SendMesh()\n");
  printf("mesh reptype %d\n",MESH_RepType(mesh));
  nf = MESH_Num_Faces(mesh);
  nr = MESH_Num_Regions(mesh);
  if (nr)
    MESH_Vol_SendMesh(mesh,rank,comm);
  else if(nf) 
    MESH_Surf_SendMesh(mesh,rank,comm);
  else {
    fprintf(stdout,"\nThis is not a valid mstk file for partition\n");
    exit(-1);
  }
  return 1;
}
  
#ifdef __cplusplus
}
#endif

